<%-- 
    Document   : editnews
    Created on : Apr 18, 2012, 12:15:31 PM
    Author     : project
--%>

<%@page import="jobportal.Dbconn"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.Connection"%>
<%@include file="header.jsp" %>
<script>
    $(document).ready(function(){
        $("#subsform").validationEngine();
        $("#lastdate").datepicker({
            dateFormat: 'yy-mm-dd',
            inline: true
        });
    });
</script>

<%
            Connection con = null;
            Statement st = null, st1 = null;
            ResultSet rs = null, rs1 = null;
            String date = "", heading = "", details = "", url = "", lastdate = "";
            int id = 0;
            if (request.getParameter("newsid") != null) {
                id = Integer.parseInt(request.getParameter("newsid"));
            }
            try {
                con = Dbconn.getConn();
                st = con.createStatement();
                st1 = con.createStatement();
                //int nojobs,activejobs;
                // rs=select count(*) as cnt from jobs
                rs = st.executeQuery("select * from news where id=" + id);

                if (rs.next()) {
                    id = rs.getInt("id");
                    date = rs.getString("date");
                    heading = rs.getString("heading");
                    details = rs.getString("details");
                    url = rs.getString("url");
                    lastdate = rs.getString("lastdate");
                }
            } catch (Exception e) {
                out.print(e);
            }

%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td>&nbsp;</td>
    </tr>
    <tr>
        <td class="blueheadbd"><strong>NEWS MANAGER - Edit News</strong> </td>
    </tr>
    <tr>
        <td><a href="addmember.jsp"></a> <table width="97%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td width="100%" height="5"></td>
                </tr>

                <tr>
                    <td align="center" class="maintext"><table width="100%" border="0" align="left" style="border: 1px solid rgb(169, 211, 225);">
                            <form action="editnews"   name="subsform" id="subsform" >

                                <tr>
                                <input type="hidden" name="newsid" value="<%=rs.getInt("id")%>">
                                <td colspan="3" valign="top" align="center" class="deepbluetext">												</td>
                                </tr>
                                <tr>
                                    <td width="19%" valign="top" class="deepbluetext"><div align="right"><span class="style27">* </span>Heading</div></td>
                                    <td width="3%" align="center" valign="top" class="deepbluetext">:</td>
                                    <td width="78%" valign="top"><div align="left">
                                            <input name="heads" type="text" id="heads" size="40" value="<%=heading%>" style="width:520px;" />
                                        </div></td>
                                </tr>
                                <tr>
                                    <td valign="top" class="deepbluetext"><div align="right"><span class="style27">* </span> Details</div></td>
                                    <td align="center" valign="top" class="deepbluetext">:</td>
                                    <td valign="top"><div align="left">
                                            <textarea name="detail" cols="50" rows="10" id="wysiwyg" style="width:520px; height:200px;"><%=details%></textarea>
                                        </div></td>
                                </tr>
                                <tr>
                                    <td valign="top" class="deepbluetext"><div align="right">News URL </div></td>
                                    <td align="center" valign="top" class="deepbluetext">:</td>
                                    <td valign="top"><div align="left">
                                            <input name="url" type="text" id="url" size="40" value="<%=url%>" style="width:520px"/>
                                        </div></td>
                                </tr>
                                <tr>
                                    <td valign="top" class="deepbluetext"><div align="right">Last Date </div></td>
                                    <td align="center" valign="top" class="deepbluetext">:</td>
                                    <td valign="top"><div align="left">
                                            <input name="lastdate" type="text" id="lastdate" size="40" value="<%=lastdate%>" readonly style="width:520px"/>
                                        </div></td>
                                </tr>

                                <tr><th height="21" valign="top" scope="row">&nbsp;</th>
                                    <td align="center" valign="top">&nbsp;</td>
                                    <td align="left" valign="top">
                                        <input name="btnsubmit" type="submit" class="button2" id="btnsubmit" value="Edit News" />&nbsp;&nbsp;&nbsp;
                                        <input type="button" name="cancelbtn" value="Back" class="button2" onClick="window.location='newslist.jsp';"></td>
                                </tr>
                                <tr>
                                    <th height="21" valign="top" scope="row"><div align="right"></div></th>
                                    <td align="center" valign="top">&nbsp;</td>
                                    <td align="left" valign="top"><div id="output"></div></td>
                                </tr>
                            </form>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td height="337" colspan="2">&nbsp;</td>
                </tr>
                <tr>
                    <td colspan="2"><style type="text/css">
                    <!--
                    .style1 {font-size: xx-small}
                    -->
                </style>
                <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tbody><tr><td><DIV class="GrayTxt SmFont PadFive" align=right><span class="style1"></span><BR>
                                </DIV>
                            </td></tr>
                        <tr>
                            <td>&nbsp;</td>
                        </tr>
                    </tbody></table></td>
    </tr>
</table>

<%@include file="footer.jsp" %>